<?php

namespace app\common\model;


class ResumeExecuteLogItems extends BaseModel
{
    /**
     *添加到记录
     * @param $params
     * @return int|string
     */
    public static function addBatch($params){
        foreach ($params as $param){
            if(empty($param['unique_key']) ||empty($param['company_id']) || empty($param['execute_id']) || empty($param['data']) ){
                continue;
            }
            $company_id = $param['company_id'];
            $execute_id = $param['execute_id'];
            $data = json_encode($param['data'],256);
            $insert[] = [
                'unique_key'=> $param['unique_key'],
                'company_id' => $company_id,
                'execute_id' => $execute_id,
                'data' => $data,
            ];
        }

        !empty($insert) && self::insertAll($insert);
        return true;
    }
}
